<template>
	<watermark>
		<view class="tab">
			<z-paging ref="paging" v-model="listAll" loading-more-no-more-text="暂无更多数据" @query="queryList">
				<view class="tab-title" slot="top">
					<view v-for="(title , index) in titleList" :key="index">
						<view :class="index==tabIndex?'border-bottom1':'border-bottom2'" @click="switchTab(index)">
							{{title.stateDesc}}
						</view>
					</view>
				</view>

				<view slot="top">
					<button type="primary" style="width: 80%;line-height: 60rpx;" @click="addHotWork">提交申请</button>
					<input class="input-border input-margin" type="text" placeholder="请输入作业内容或地点" />
					<radio-group class="my-readio-group" @change="changeRadio">
						<radio :value="0" :checked="true">全部</radio>
						<radio :value="1">待审批</radio>
						<radio :value="2">作业中</radio>
						<radio :value="3">待验收</radio>
						<radio :value="4">已完成</radio>
					</radio-group>
					<view style="width: 100%;align-items: center;text-align: center;">总计{{listAll.length}}数据</view>
				</view>

				<view v-for="(item,index) in listAll" :key="index" style="border: 1px solid #eee;padding: 1rem;"
					@click="clickItem">
					<view class="item-line">
						<view>电焊</view>
						<view>2024-06-27</view>
					</view>
					<view class="item-line" style="color: #666;">
						<view>总装护栏-1</view>
						<view>待签名</view>
					</view>

				</view>
			</z-paging>
		</view>
	</watermark>
</template>

<script>
	import hotWorkApi from "@/pages_psm/api/permit-to-work/hot_work.js"
	export default {
		data() {
			return {
				listAll: [{
					aaa: "1"
				}],
				titleList: [{
						stateValue: "0",
						stateDesc: "我提交的"
					},
					{
						stateValue: "1",
						stateDesc: "我收到的"
					}
				],
				tabIndex: 0
			}
		},
		methods: {
			switchTab(index) {
				this.tabIndex = index
			},
			queryList(pageNo, pageSize) {
				var that = this
				const params = {
					page: pageNo,
					limit: pageSize * 3
				}
				///测试数据
				setTimeout(() => {
					that.$refs.paging.complete([{
						aaa: "1"
					}]);
				}, 200);

			},
			/**
			 * 点击条目

			 * @param {Object} item
			 */
			clickItem(item) {
				uni.navigateTo({
					url:"/pages_psm/model/permit-to-work/hot-work/hot-work-info"
				})
			},
			/**
			 * 新增动火申请
			 */
			addHotWork() {
				uni.navigateTo({
					url: "/pages_psm/model/permit-to-work/hot-work/hot-work-add"
				})
			}
		}
	}
</script>

<style>
	@import url("/pages_psm/model/permit-to-work/common-style.css");
</style>